package com.sikaryofficial.workbench.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sikaryofficial.workbench.domain.dto.req.goods.GoodsFilterReq;
import com.sikaryofficial.workbench.domain.dto.req.goods.GoodsListReq;
import com.sikaryofficial.workbench.domain.dto.resp.goods.GoodsDTO;
import com.sikaryofficial.workbench.domain.dto.resp.goods.GoodsFilterDTO;
import com.sikaryofficial.workbench.domain.entity.Goods;
import com.sikaryofficial.workbench.mapper.GoodsMapper;
import com.sikaryofficial.workbench.service.IGoodsService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 商品Service业务层处理
 *
 * @author wuweihong
 * @date 2024-09-23
 */
@Service
@Slf4j
public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements IGoodsService {
    @Autowired
    private GoodsMapper goodsMapper;

    /**
     * 获取活动分页数据
     *
     * @param customerPage
     * @param req
     * @return
     */
    @Override
    public IPage<GoodsDTO> getGoodsByPage(Page<GoodsDTO> customerPage, GoodsListReq req) {
        return goodsMapper.getGoodsByPage(customerPage, req);
    }

    /**
     * 查询商品筛选条件
     *
     * @param req
     * @return
     */
    @Override
    public GoodsFilterDTO queryGoodsFilter(GoodsFilterReq req,Long userId) {
        return goodsMapper.queryGoodsFilter(req,userId);
    }

    @Override
    public Boolean updateRecommendGoods(List<Long> goodsIds) {
        return goodsMapper.updateRecommendGoods(goodsIds);
    }

    @Override
    public List<Goods> navigation(Long userId) {
        return goodsMapper.navigation(userId);
    }

}
